from django.contrib import admin
from .models import Blog,BlogComment,BlogCategory
# Register your models here.
###


'''
Django 管理后台配置的 用于自定义显示字段和行为
'''

class BlogCategoryAdmin(admin.ModelAdmin):
    list_display = ['name']   ## list_display 控制在后台要显示的哪些字段

class BlogAdmin(admin.ModelAdmin):
    list_display = ['title','content','pub_time','category','author']

class BlogCommentAdmin(admin.ModelAdmin):
    list_display = ['content','pub_time','author','blog']

## 注册模型及自定义管理类
admin.site.register(BlogCategory,BlogCategoryAdmin)
admin.site.register(Blog,BlogAdmin)
admin.site.register(BlogComment,BlogCommentAdmin)